﻿using BEGDC.CC.Web;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.UnitTesting.Web;
using System;
using NetBpm.Workflow.Definition.EComp;
using BEGDC.Utility.Castle;
using System.IO;

namespace ASB.CC.Test
{


    /// <summary>
    ///This is a test class for ProcessManagementTest and is intended
    ///to contain all ProcessManagementTest Unit Tests
    ///</summary>
    [TestClass()]
    public class ProcessManagementTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        [TestMethod()]
        public void DeployTest()
        {
            //byte[] buff = new byte[this.File1.PostedFile.InputStream.Length];
            //this.File1.PostedFile.InputStream.Read(buff, 0, buff.Length);

            IDefinitionSessionLocal definitionComponent = null;

            definitionComponent = AppContainer.Instance["DefinitionSession"] as IDefinitionSessionLocal;


            foreach (string xml in Directory.GetFiles(@"C:\3.5\CCWeb\Process", "*.zip", SearchOption.AllDirectories))
            {
                byte[] buff = File.ReadAllBytes(xml);
                definitionComponent.DeployProcessArchive(buff);
            }
         


        }
    }
}
